# Contributor: Thomas Kienlen <kommander@laposte.net>
# Maintainer: Thomas Kienlen <kommander@laposte.net>
pkgname=udpt
pkgver=3.1.1
pkgrel=0
pkgdesc="Lightweight UDP torrent tracker"
url="https://github.com/naim94a/udpt"
arch="x86_64 armv7 armhf aarch64 x86 ppc64le" # limited by rust/cargo
license="MIT"
makedepends="cargo"
pkgusers="udpt"
pkggroups="udpt"
install="udpt.pre-install"
subpackages="$pkgname-openrc"
source="https://github.com/naim94a/udpt/archive/udpt-$pkgver/udpt-$pkgver.tar.gz
	udpt.initd
	udpt.conf
	cargo.toml.patch
	"
builddir="$srcdir/udpt-udpt-$pkgver"

build() {
	cargo build --release --locked
}

check() {
	cargo test --locked --target-dir=target
}

package() {
	install -D -m 755 target/release/udpt-rs "$pkgdir/usr/bin/udpt"
	install -D -m 755 "$srcdir/udpt.initd" "$pkgdir/etc/init.d/udpt"
	install -D -m 660 -o udpt -g udpt "$srcdir/udpt.conf" "$pkgdir/etc/udpt.conf"
}

sha512sums="
05a707ec22d0d27ef7ed47eb2144b27c448ae48cc78d7fa9492a81911a7a8759768b079ab71df2a1ae63897241b70712dc0728fe6877481680d53e87536b1ff5  udpt-3.1.1.tar.gz
e233e4d76a0ad458579810ebb9d5697604bfebb0f51f218bcd27ceff55d2a86c50bc28b278da6793f6e688492eb962043f1e876852b3d8dcec046bff56abe78b  udpt.initd
9646e424a2fe4355745241ce84f989453bf75b26bad772d2ba7e72eade6b51d5f8d4b6e3eb671edff3c892a47dda029a3aed93276a3a4f992db13cce57e1521d  udpt.conf
a154f539a10419fb7f3ff3c47938d15960ef74f41c537c8dbc8435a460b506506c431b1331d4e6b62dd6aaf0b7cf6d7f98fd17b9d49779043a308b6b4152497c  cargo.toml.patch
"
